<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#div1 {
				width: 400px;
				height: 400px;
				background-color: #959091;
			}
		</style>
	</head>
	<table>
		<tr>
			<td><big>Get</big></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Get('http://poetry.apiopen.top/poetry?count=2&page=1')">来首古诗</button></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Get('https://api.apiopen.top/getAllUrl')">查看所有接口</button></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Get('https://api.apiopen.top/getImages')">来张美图</button></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Get('http://poetry.apiopen.top/getTime')">几点了</button></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Get('http://poetry.apiopen.top/sentences')">来句名言</button></td>
		</tr>
		<tr>
			<td><big>Post</big></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Post('https://api.apiopen.top/getImages','1','1')">随机来一张美图</button></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Post1('https://api.apiopen.top/searchAuthors','李白')">来点李白的诗</button></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Post('https://api.apiopen.top/getWangYiNews','1','2')">获取网易新闻</button></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Post('https://api.apiopen.top/getTangPoetry','1','2')">来点唐朝古诗词</button></td>
		</tr>
		<tr>
			<td><button type="button" onclick="Post('https://api.apiopen.top/getSongPoetry','1','2')">来点宋朝古诗词</button></td>
		</tr>
	</table>
	<br>
	<div id="div1">
		背景板
	</div>
	<body>
		<script type="text/javascript">
			// var div1 = document.getElementById('div1');
			// var div2=document.createElement('div');
			function Get(url) {
				var ajax = new XMLHttpRequest();
				ajax.open('GET', url);
				ajax.send();
				ajax.onreadystatechange = function() {
					if (ajax.readyState == 4 && ajax.status == 200) {
						// console.log(ajax.responseText.length);
						console.log(ajax.responseText);
						// div2.innerHTML='div'+ajax.responseText+'</div>';
						// div1.appendChild(ajax.responseText);
					}
				}
			}

			function Post(url, par1, par2) {
				var ajax = new XMLHttpRequest();
				ajax.open('POST', url);
				ajax.send('page=' + par1 + '&count=' + par2);
				ajax.onreadystatechange = function() {
					if (ajax.readyState == 4 && ajax.status == 200) {
						console.log(ajax.responseText);
					}
				}
			}
			function Post1(url, par1) {
				var ajax = new XMLHttpRequest();
				ajax.open('POST', url);
				ajax.send('name='+par1);
				ajax.onreadystatechange = function() {
					if (ajax.readyState == 4 && ajax.status == 200) {
						console.log(ajax.responseText);
					}
				}
			}
		</script>
	</body>
</html>
